package com.xiaotian.common.exception;

import com.xiaotian.common.response.ResultCode;
import lombok.Data;

@Data
public class CustomException extends RuntimeException {

    private ResultCode resultCode;

    public CustomException(ResultCode resultCode) {
        this.resultCode = resultCode;
    }

    @Override
    public String getMessage() {
        return "{" +
                "success=" + resultCode.success() +
                ", code=" + resultCode.code() +
                ", message='" + resultCode.message() + '\'' +
                '}';
    }
}
